VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Object = "{736A8444-E374-41A8-B526-1B07FD2F3F5B}#1.0#0"; "BLacKPeaRLOCX.ocx"
Begin VB.Form FrmInputBarang 
   BackColor       =   &H00000000&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   5400
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   6120
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5400
   ScaleWidth      =   6120
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin BLacKPeaRLOCX.BLacKFrame Frame 
      Height          =   5415
      Left            =   0
      TabIndex        =   8
      Top             =   0
      Width           =   6135
      _ExtentX        =   10821
      _ExtentY        =   9551
      BackColor1      =   0
      BackColor2      =   4210752
      Caption         =   "Master Barang"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   49152
      TitleColor1     =   0
      TitleColor2     =   4210752
      TitleGradient   =   2
      TitleHeight     =   400
      BorderColor     =   49152
      BorderWidth     =   2
      Begin ComctlLib.ListView lvbar 
         Height          =   2055
         Left            =   120
         TabIndex        =   7
         Top             =   3240
         Width           =   5895
         _ExtentX        =   10398
         _ExtentY        =   3625
         View            =   3
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   327682
         ForeColor       =   49152
         BackColor       =   0
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   5
         BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "No"
            Object.Width           =   265
         EndProperty
         BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   1
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Nama Barang"
            Object.Width           =   2910
         EndProperty
         BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   2
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Harga Beli"
            Object.Width           =   1764
         EndProperty
         BeginProperty ColumnHeader(4) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   3
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Harga Jual"
            Object.Width           =   1764
         EndProperty
         BeginProperty ColumnHeader(5) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   4
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Stock"
            Object.Width           =   882
         EndProperty
      End
      Begin BLacKPeaRLOCX.ButtonNix CmdHapus 
         Height          =   375
         Left            =   2880
         TabIndex        =   5
         Top             =   2640
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "Hapus"
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   16777215
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmInputBarang.frx":0000
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin VB.TextBox txtstock 
         BackColor       =   &H00404040&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   250
         Left            =   1590
         TabIndex        =   3
         Top             =   2205
         Width           =   495
      End
      Begin BLacKPeaRLOCX.ButtonNix cmdTutup 
         Height          =   375
         Left            =   4200
         TabIndex        =   6
         Top             =   2640
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "Tutup"
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   16777215
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmInputBarang.frx":001C
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin BLacKPeaRLOCX.ButtonNix CmdupdateHarga 
         Height          =   375
         Left            =   1560
         TabIndex        =   4
         Top             =   2640
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "Simpan"
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   16777215
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmInputBarang.frx":0038
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin VB.ComboBox txtnamabar 
         BackColor       =   &H00000000&
         ForeColor       =   &H0000C000&
         Height          =   315
         Left            =   1560
         Sorted          =   -1  'True
         TabIndex        =   0
         Top             =   720
         Width           =   2775
      End
      Begin VB.TextBox txthargabel 
         BackColor       =   &H00404040&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   250
         Left            =   1590
         TabIndex        =   1
         Top             =   1245
         Width           =   1215
      End
      Begin VB.TextBox txthargajual 
         BackColor       =   &H00404040&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   250
         Left            =   1590
         TabIndex        =   2
         Top             =   1725
         Width           =   1215
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "Stock Awal"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   255
         Left            =   120
         TabIndex        =   12
         Top             =   2160
         Width           =   1095
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H00004040&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H00C0FFC0&
         Height          =   345
         Left            =   1560
         Shape           =   4  'Rounded Rectangle
         Top             =   2160
         Width           =   570
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "Nama Barang"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   255
         Left            =   120
         TabIndex        =   11
         Top             =   720
         Width           =   1095
      End
      Begin VB.Label Label7 
         BackStyle       =   0  'Transparent
         Caption         =   "Harga Jual"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   255
         Left            =   120
         TabIndex        =   10
         Top             =   1680
         Width           =   1095
      End
      Begin VB.Label Label29 
         BackStyle       =   0  'Transparent
         Caption         =   "Harga Beli"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   -1  'True
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   255
         Left            =   120
         TabIndex        =   9
         Top             =   1200
         Width           =   1095
      End
      Begin VB.Shape Shape13 
         BackColor       =   &H00004040&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H00C0FFC0&
         Height          =   345
         Left            =   1560
         Shape           =   4  'Rounded Rectangle
         Top             =   1200
         Width           =   1290
      End
      Begin VB.Shape Shape14 
         BackColor       =   &H00004040&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H00C0FFC0&
         Height          =   345
         Left            =   1560
         Shape           =   4  'Rounded Rectangle
         Top             =   1680
         Width           =   1290
      End
   End
End
Attribute VB_Name = "FrmInputBarang"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdhapus_Click()
On Error GoTo hell
If MsgBox("Anda yakin akan menghapus data barang tersebut???", vbInformation + vbYesNo) = vbYes Then
rec.Open "select databarang.* from databarang where databarang.namabarang= '" & txtnamabar.Text & "'", conn, adOpenStatic, adLockOptimistic
If rec.RecordCount = 0 Then
rec.Close
MsgBox "Tidak ada data yang akan di hapus.", vbInformation, "Blank"
Else
rec.Delete
rec.Close
MsgBox "Barang sudah di hapus dari list data barang.", vbInformation, "Sukses"
End If
lvbar.ListItems.Clear
laodbar
Else
Exit Sub
End If

IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "cmdhapus", Me.Name
 Resume IfNoErr

End Sub
Private Sub CmdTutup_Click()
Unload Me
End Sub

Private Sub CmdupdateHarga_Click()
If Frame.Caption = "Master Barang" Then
addbar
ElseIf Frame.Caption = "Pembelian" Then
pemb
End If
End Sub
Private Sub addbar()
On Error GoTo hell
If txtnamabar.Text = "" Or txthargabel.Text = "" Or txthargajual.Text = "" Then
MsgBox "Masih ada data yang kosong, semua data harus diisi.", vbInformation, "Blank"
Exit Sub
Else
rec.Open "select databarang.* from databarang where databarang.namabarang= '" & txtnamabar.Text & "'", conn, adOpenStatic, adLockOptimistic
If rec.RecordCount = 1 Then
If MsgBox("Data sudah ada, edit data sebelumnya???", vbInformation + vbYesNo, "Verf") = vbYes Then
rec(0) = txtnamabar.Text
rec(1) = txthargabel.Text
rec(2) = txthargajual.Text
rec.Update
rec.Close
bersih
Else
rec.Close
bersih
End If
Else
rec.AddNew
rec(0) = txtnamabar.Text
rec(1) = txthargabel.Text
rec(2) = txthargajual.Text
rec(3) = txtstock.Text
rec.Update
rec.Close
MsgBox "Barang behasil di tambah.", vbOKOnly, "Sukses"
bersih
End If
End If
lvbar.ListItems.Clear
laodbar

IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "addbar", Me.Name
 Resume IfNoErr

End Sub

Private Sub Form_Load()
On Error GoTo hell
rec.Open "databarang", conn, adOpenStatic, adLockOptimistic
If rec.RecordCount = 0 Then
rec.Close
Exit Sub
Else
rec.MoveFirst
While Not rec.EOF
txtnamabar.AddItem rec!namabarang
rec.MoveNext
Wend
rec.Close
End If
laodbar

IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "FormLoad", Me.Name
 Resume IfNoErr

End Sub
Private Sub lvbar_DblClick()
On Error Resume Next
If Frame.Caption = "Master Barang" Then
txtnamabar.Text = lvbar.SelectedItem.SubItems(1)
txthargabel.Text = lvbar.SelectedItem.SubItems(2)
txthargajual.Text = lvbar.SelectedItem.SubItems(3)
txtstock.Text = lvbar.SelectedItem.SubItems(4)
ElseIf Frame.Caption = "Pembelian" Then
txtnamabar.Text = lvbar.SelectedItem.SubItems(1)
txthargabel.Text = lvbar.SelectedItem.SubItems(2)
txthargajual.Text = lvbar.SelectedItem.SubItems(3)
End If
End Sub
Private Sub laodbar()
On Error GoTo hell
rec.Open "databarang", conn, adOpenStatic, adLockOptimistic
With rec
While Not .EOF
Set lstItem = lvbar.ListItems.Add(, , lvbar.ListItems.Count + 1 & ".")
lstItem.SubItems(1) = rec(0)
lstItem.SubItems(2) = rec(1)
lstItem.SubItems(3) = rec(2)
lstItem.SubItems(4) = rec(3)
.MoveNext
Wend
End With
rec.Close
IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "loadbar", Me.Name
 Resume IfNoErr

End Sub

Private Sub pemb()
On Error GoTo hell
If txtnamabar.Text = "" Or txthargabel.Text = "" Or txthargajual.Text = "" Or txtstock.Text = "" Then
MsgBox "Data tidak lengkap.", vbInformation, "Blank"
Exit Sub
Else
rec.Open "select databarang.* from databarang where databarang.namabarang= '" & txtnamabar.Text & "'", conn, adOpenStatic, adLockOptimistic
If rec.RecordCount = 1 Then
rec(3) = Val(rec(3)) + Val(txtstock.Text)
rec.Update
rec.Close
tampem
MsgBox "Pembelian barang berhasil.", vbInformation
bersih
Else
If MsgBox("Data barang belum ada, tambah data ke stock?", vbYesNo) = vbYes Then
rec.AddNew
rec(0) = txtnamabar.Text
rec(1) = txthargabel.Text
rec(2) = txthargajual.Text
rec(3) = txtstock.Text
rec.Update
rec.Close
tampem
MsgBox "Barang behasil di tambah.", vbOKOnly, "Sukses"
bersih
Else
Exit Sub
End If
End If
lvbar.ListItems.Clear
laodbar
End If
IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "pemb", Me.Name
 Resume IfNoErr

End Sub

Private Sub tampem()
On Error GoTo hell
rec.Open "Pembelian", conn, adOpenStatic, adLockOptimistic
rec.AddNew
rec(0) = Format(Now, "DD-MM-YYYY")
rec(1) = "Pemb-" & Val(rec.RecordCount) + 1
rec(2) = txtnamabar.Text
rec(3) = txthargabel.Text
rec(4) = txthargajual.Text
rec(5) = txtstock.Text
rec(6) = Val(txthargabel.Text) * Val(txtstock.Text)
rec(7) = Format(Now, "DD")
rec(8) = Format(Now, "MM")
rec(9) = Format(Now, "YYYY")
rec.Update
rec.Close

IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "tampem", Me.Name
 Resume IfNoErr

End Sub

Private Sub txtnamabar_GotFocus()
txtnamabar.Backcolor = &H0&
txtnamabar.Forecolor = vbWhite
End Sub

Private Sub txtnamabar_KeyPress(KeyAscii As Integer)
On Error GoTo hell
If Frame.Caption = "Pembelian" Then
If KeyAscii = 13 Then
rec.Open "select databarang.* from databarang where databarang.namabarang='" & txtnamabar.Text & "'", conn, adOpenStatic, adLockOptimistic
If rec.RecordCount = 0 Then
rec.Close
MsgBox "Nama barang tidak diketahui.", vbInformation, "Unknown"
txtnamabar.SetFocus
Else
txthargabel.Text = rec(1)
txthargajual.Text = rec(2)
rec.Close
txtstock.Enabled = True
txtstock.SetFocus
End If
End If
End If

IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "txtnamabar_keypress", Me.Name
 Resume IfNoErr

End Sub

Private Sub txtnamabar_LostFocus()
txtnamabar.Backcolor = &H404040
txtnamabar.Forecolor = &HC000&
End Sub

Private Sub txthargabel_GotFocus()
txthargabel.Backcolor = &H0&
txthargabel.Forecolor = vbWhite
End Sub

Private Sub txthargabel_LostFocus()
txthargabel.Backcolor = &H404040
txthargabel.Forecolor = &HC000&
End Sub

Private Sub txthargajual_GotFocus()
txthargajual.Backcolor = &H0&
txthargajual.Forecolor = vbWhite
End Sub

Private Sub txthargajual_LostFocus()
txthargajual.Backcolor = &H404040
txthargajual.Forecolor = &HC000&
End Sub

Private Sub txtstock_GotFocus()
txtstock.Backcolor = &H0&
txtstock.Forecolor = vbWhite
End Sub

Private Sub txtstock_LostFocus()
txtstock.Backcolor = &H404040
txtstock.Forecolor = &HC000&
End Sub

Private Sub bersih()
txtnamabar.Text = ""
txthargabel.Text = ""
txthargajual.Text = ""
txtstock.Text = ""
End Sub

